﻿#Include ..\baseHandle.ahk

class CheckConf extends BaseHandle {

  static Handle(parsed) {
    try {
      r := ToString(MeowConf.Of(parsed.target).data)
      if parsed.hasParam('m')
        MsgBox r
      if parsed.hasParam('d')
        return this.Succ(r, 'e')
      else
        return this.Succ('clear.')
    } catch as e {
      return this.Fail(e.Message)
    }
  }

  static Spec() {
    return {
      cmd: 'cc',
      desc: '测试配置文件语法是否正确`neg: e oc -v wt | cc -m',
      format: 'cc [-d -m] <target>',
      params: [{
        name: 'd',
        desc: '返回详细数据'
      }, {
        name: 'm',
        desc: '使用msgbox显示'
      }],
      args: {
        desc: '要测试的配置文件路径',
        isOptional: false,
        cacheable: false,
      },
      extra: {
        isEnable: false
      }
    }
  }

}
